{{extend "layout_auth.html"}}

{{block content}}
<div class="row">
    <div class="col-lg-4 col-lg-offset-4">
        {{if result==-1:}}
        <div class="alert alert-warning alert-dismissable">
            <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
            {{=message}}
        </div>
        {{pass}}
        <div class="login-panel panel panel-default">
            <div class="panel-heading">
                <h3 class="panel-title">请登录</h3>
            </div>
            <div class="panel-body">
                <form role="form" action="/login" method="post">
                    <fieldset>
                        <div class="form-group">
                            <input class="form-control cj-validator" placeholder="用户名" name="txt-username" type="text" autofocus cj-required cj-name="用户名">
                        </div>
                        <div class="form-group">
                            <input class="form-control cj-validator" id="txt-passwd" placeholder="密码" type="password" cj-required cj-name="密码">
                            <input type="hidden" name="txt-passwd" id="hid-passwd" />
                        </div>
                        <div class="checkbox ">
                            <label>
                                <input name="remember" type="checkbox" checked value="Remember Me">记住我
                            </label>
                            <a href="/auth/register">注册</a>
                            <!-- <a href="#">忘记密码</a> -->
                        </div>
                        <!-- Change this to a button or input when using this as a form -->

                        <button class="btn btn-success btn-block" id="btn-login" type="submit">登录</button>
                        
                    </fieldset>
                </form>
            </div>
        </div>
    </div>
</div>
{{end}}

{{block js}}
<script src="{{=url_for_static('chujue-js/chujue_validate.js')}}"></script>
<script src="{{=url_for_static('MD5.js')}}"></script>
<script type="text/javascript">
    $(function(){
        $("#btn-login").click(function() {
            var validator = new Chujue_Validator();
            if (validator.validation(".cj-validator")) {
                var md5 = MD5($("#txt-passwd").val());
                $("#hid-passwd").val(md5);
                return true;
            }
            return false;
        });
    });
</script>
{{end}}

